<?php

declare(strict_types=1);

namespace App\Model\Admin;

use App\Model\Model;
use App\Traits\Model\Admin\Menu as MenuTraits;

/**
 * @property int $id 
 * @property int $parent_id 父级ID
 * @property string $name 菜单名称
 * @property string $app 应用
 * @property string $icon 图标
 * @property string $path 路径
 * @property int $sort 排序
 * @property string $desc 描述
 * @property int $status 状态|["禁用","启用"]
 * @property \Carbon\Carbon $created_at 
 * @property \Carbon\Carbon $updated_at 
 */
class Menu extends Model
{
    use MenuTraits;

    /**
     * 模块名称
     * @var string
     */
    protected string $modularName = '菜单管理';

    /**
     * The table associated with the model.
     */
    protected ?string $table = 'menu';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'parent_id', 'name', 'app', 'level', 'icon', 'path', 'sort', 'desc', 'status', 'created_at', 'updated_at'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'parent_id' => 'integer', 'sort' => 'integer', 'level' => 'integer', 'status' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];

    /**
     * 自动新增
     * @var array|string[]
     */
    public array $insert = ['parent_id'=>0, 'app', 'sort'];
}
